﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OSA.Policlinic.UI.WFAplication.DoctorWCF.RegistryServiceReference;

namespace OSA.Policlinic.UI.WFAplication.DoctorWCF
{
    public partial class ChooseDoctor : Form
    {
        public Doctor choosedDoctor;
        private IRegistryBusinessApplication registryBusinessApplication;
        private List<Doctor> listOfDoctor; 
        public ChooseDoctor()
        {
            InitializeComponent();
            listOfDoctor = new List<Doctor>();
            registryBusinessApplication = RegistryBusinessApplicationHome.GetInstanse();
            listOfDoctor.AddRange(registryBusinessApplication.GetAllDoctors());
            doctorBindingSource.DataSource = listOfDoctor;
        }

        private void doctorDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            Doctor doc = (Doctor)doctorDataGridView.Rows[e.RowIndex].DataBoundItem;
            choosedDoctor = doc;
            this.Close();
        }
    }
}
